package com.gary.demo.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gary.demo.dao.UserMapper;
import com.gary.demo.entity.User;
import com.gary.demo.vo.param.UserQueryParamVO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@CrossOrigin("*")
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserMapper userMapper;

    @PostMapping("/add")
    public void add(@RequestBody User user) {
        userMapper.insert(user);
    }

    @GetMapping("/info")
    public User getById(Integer id) {
        return userMapper.selectById(id);
    }

    @PostMapping("/delete")
    public void delete(@RequestBody User user) {
        userMapper.deleteById(user.getId());
    }

    @GetMapping("/pageQuery")
    public IPage<User> pageQuery(UserQueryParamVO paramVO) {
        return null;
    }

}
